package com.jie.servlet;

import com.jie.dao.impl.RegionDaoImpl;
import com.jie.entity.Agency;
import com.jie.entity.Region;
import com.jie.service.AgencyService;
import com.jie.service.impl.AgencyServiceImpl;
import com.jie.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by 12904 on 2018/8/17.
 */
@WebServlet(name = "findByAgencyidServlet")
public class findByAgencyidServlet extends HttpServlet
{
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {

        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        //接收代理信息
        Agency agency = new Agency();

        AgencyService service = new AgencyServiceImpl();

        int uid = Integer.parseInt(request.getParameter("uid"));
        agency = service.findAgency(service.findByuid(uid));

        request.setAttribute("agency",agency);
        request.getRequestDispatcher("agency_update.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
         doPost(request,response);
    }
}
